#pragma once
#include "Stdafx.h"
#include "Object3D.h"

namespace Pulpy
{
	class Particle : public Object3D
	{
	private:
		float _Life;
		Vector3D<float> _Direction;
	public:
		Particle():Object3D() {};
		Particle(const Vector3D<float> &start, const Vector3D<float> &dir, float life): Object3D(), _Direction(dir), _Life(life) { setPosition(start); }
		float getLife() { return _Life; }
		void update(bool drop)
		{
			if(drop)
				_Direction -= (Pulpy::_GRAVITY3D_ / 10);
			move(_Direction);
			_Life--;
		}
		void draw(void (*func)())
		{
			glColor4f(1,1,1,_Life);
			glPushMatrix();
			glTranslatef(getPosition().getX(), getPosition().getY(), getPosition().getZ());
			func();
			glPopMatrix();
		}
	};
}